﻿using System;
using System.Diagnostics.Contracts;
using Adalbertus.BudgetPlanner.Domain;
using Adalbertus.BudgetPlanner.Domain.Repositories;

namespace Adalbertus.BudgetPlanner.Services.CodeContracts
{
    [ContractClassFor(typeof(IBudgetService))]
    public abstract class IBudgetServiceContract : BaseService<Budget>, IBudgetService
    {
        protected IBudgetServiceContract(IRepositoryFactory repositoryFactory, IUnitOfWorkProvider unitOfWorkProvider) : base(repositoryFactory, unitOfWorkProvider)
        {
        }

        public Budget GenerateEmptyBudgetForNextMonth(DateTime contextDate)
        {
            Contract.Ensures(Contract.Result<Budget>() != null);
            Contract.Ensures(Contract.Result<Budget>().DateFrom < Contract.Result<Budget>().DateTo);
            Contract.Ensures(Contract.Result<Budget>().DateFrom > contextDate);
            Contract.Ensures(Contract.Result<Budget>().DateFrom <= contextDate.AddMonths(1));
            Contract.Ensures(Contract.Result<Budget>().DateTo < contextDate.AddMonths(2));
            throw new NotImplementedException();
        }

        public Budget GetBudgetByDate(DateTime budgetDate)
        {
            throw new NotImplementedException();
        }

        public Budget GetDraftedBudget()
        {
            throw new NotImplementedException();
        }

        public void AddRevenueToBudget(string name, decimal value, DateTime date, Budget budget)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(name));
            Contract.Requires(value > 0);
            Contract.Requires<ArgumentNullException>(budget != null);
            //Contract.Ensures(Contract.Result<Revenue>() != null);
            //Contract.Ensures(Contract.Result<Revenue>().Source != null);
            throw new NotImplementedException();
        }
    }
}
